﻿using System;
using System.Linq;

Random random = new Random();
int[] numbers = new int[100];
for (int i = 0; i < numbers.Length; i++)
{
    numbers[i] = random.Next(1000);
}
Console.WriteLine("随机生成的100个整数：");
foreach (int num in numbers)
{
    Console.Write(num + " ");
}
Console.WriteLine();

var sortedNumbers = from num in numbers
                    orderby num descending
                    select num;
double sum = sortedNumbers.Sum();
double average = sortedNumbers.Average();
Console.WriteLine("从大到小排序后：");
foreach (int num in sortedNumbers)
{
    Console.Write(num + " ");
}
Console.WriteLine();
Console.WriteLine("和为：" + sum);
Console.WriteLine("平均数为：" + average);
